PATHMac OS 8 and 9 Developer Documentation > Human Interface Toolbox > Appearance Manager >

Programming With the Appearance Manager


SetThemeBackground

Applies a theme-compliant color or pattern to the background of the current port.

pascal OSStatus SetThemeBackground (
                     ThemeBrush inBrush,
                     SInt16 inDepth,
                     Boolean inIsColorDevice);
inBrush
A value of type ThemeBrush . Pass a constant specifying the theme brush to which to set the background; see Theme Brush Constants for descriptions of possible values.
inDepth
A signed 16-bit integer. Pass a value specifying the bit depth (in bits per pixel) of the current graphics port.
inIsColorDevice
A value of type Boolean . Pass true to indicate that you are drawing on a color device. Pass false for a monochrome device.
function result
A result code. The result code appearanceBadBrushIndexErr indicates that the brush constant passed was not valid. For other possible result codes, see Result Codes .
DISCUSSION

Your application should call the SetThemeBackground function each time you wish to draw in a specified brush type. Note that the SetThemeBackground function aligns patterns with 0,0 in the current port. To align a pattern independently of the port origin, use the function ApplyThemeBackground .

Because the constant in the inBrush parameter can specify a color or pattern, depending on the current theme, your application must save and restore the current drawing state of the graphics port around calls to SetThemeBackground . Under Appearance Manager 1.1 and later, you can use the functions GetThemeDrawingState and SetThemeDrawingState to do this.

Prior to Appearance Manager 1.1, you must save and restore the pnPixPat and bkPixPat fields of your graphics port when saving the text and background colors. Because patterns in the bkPixPat field override the background color of the window, call the QuickDraw function BackPat to set your background pattern to a normal white pattern. This ensures that you can use RGBBackColor to set your background color to white, call the QuickDraw function EraseRect , and get the expected results.

VERSION NOTES

Available with Appearance Manager 1.0 and later.


© 1999 Apple Computer, Inc. – (Last Updated 29 April 99)